package common.database;

import java.io.IOException;
import java.io.Reader;

import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

public class DBUtil {
	private static final String IBATIS_CONFIG = "tutorial/ibatis/example1/ibatis-config.xml";
	
	public static SqlSessionFactory createSqlMapper() throws IOException {
		Reader reader = Resources.getResourceAsReader(IBATIS_CONFIG);
		return new SqlSessionFactoryBuilder().build(reader);
	}
}
